<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>

    <xsl:template match="/root">

          <table class="datatable" border="0" cellpadding="0" cellspacing="0">
            <tr>
			<th></th>
				<th>Ref</th>
				<th>Date</th>
				<th>SubTotal</th>
				<th>Tax</th>
				<th>Total</th>
				<th>Accepted</th>
				<th></th>
				<th></th>
            </tr>
			  
            <xsl:for-each select="/root/item">
			<xsl:sort select="./genxml/textbox/dateestimate" data-type="text" order="descending"/>
              <tr>
			  <td>
			  <a>
			  <xsl:attribute name="href">
							<xsl:text>/tabid/</xsl:text>
							<xsl:value-of select="/root/@tabid" disable-output-escaping="yes"/>
							<xsl:text>/ctl/ESTIMATES/mid/</xsl:text>
							<xsl:value-of select="/root/@mid" disable-output-escaping="yes"/>
							<xsl:text>/itemid/</xsl:text>
							<xsl:value-of select="./genxml/hidden/itemid" disable-output-escaping="yes"/>
							<xsl:text>/Default.aspx</xsl:text>
							<xsl:text>?SkinSrc=</xsl:text>
							<xsl:value-of select="/root/@skinsrc" disable-output-escaping="yes"/>
						</xsl:attribute>		  
			  <img src="/DesktopModules/NBright/NBrightEspace/img/edit.png" />
			  </a>
			  </td>
                <td>
					<xsl:value-of select="./genxml/hidden/estimateref" disable-output-escaping="yes"/>
				</td>
                <td>
					<xsl:value-of select="substring(./genxml/textbox/dateestimate,1,10)" disable-output-escaping="yes"/>
				</td>
<td>
<xsl:value-of select="genxml/hidden/dblsubtotal" disable-output-escaping="yes"/>
</td>
<td>
<xsl:value-of select="genxml/hidden/dbltaxtotal" disable-output-escaping="yes"/>
</td>
<td>
<xsl:value-of select="genxml/hidden/dblgrandtotal" disable-output-escaping="yes"/>
</td>              
<td>
	<xsl:if test='./genxml/checkbox/chkaccepted="True"'>
		<img src="/DesktopModules/NBright/NBrightEspace/img/true.png" />
	</xsl:if>
	<xsl:if test='./genxml/checkbox/chkaccepted!="True"'>
		<img src="/DesktopModules/NBright/NBrightEspace/img/false.png" />
	</xsl:if>
</td>
<td>
<div>
<a target="_blank" >
<xsl:attribute name="href">
<xsl:text>/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getpdf&amp;pdf=estimatepdf&amp;pdfref=estimateref&amp;itemid=</xsl:text>
<xsl:value-of select="genxml/hidden/itemid" disable-output-escaping="yes"/>
</xsl:attribute>		  
<img src="/DesktopModules/NBright/NBrightEspace/img/pdf_file.png" alt="View PDF with logo" border="0" />
</a>
</div>
</td>

<td>
<div>
<a target="_blank" >
<xsl:attribute name="href">
<xsl:text>/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getpdf&amp;pdf=estimateprintpdf&amp;pdfref=estimateref&amp;itemid=</xsl:text>
<xsl:value-of select="genxml/hidden/itemid" disable-output-escaping="yes"/>
</xsl:attribute>
<img src="/DesktopModules/NBright/NBrightEspace/img/printer.png" alt="View PDF without logo" border="0" />
</a>
</div>
</td>

</tr>
            </xsl:for-each>

          </table>

		
    </xsl:template>

</xsl:stylesheet>
